//
//  HeaderCell.m
//  StarOrangeStaff
//
//  Created by lshenrong on 2020/6/22.
//  Copyright © 2020 lshenrong. All rights reserved.
//

#import "HeaderBannerCell.h"
#import "SDCycleScrollView.h"

#define  kCycleMainCellOffset  100//  (70.0 + 14)

@interface HeaderBannerCell ()<SDCycleScrollViewDelegate>

//@property (nonatomic,strong) UIView *homeBackgroundView;
@property(nonatomic,strong) SDCycleScrollView *cycleScrollView;
@property (nonatomic,strong) NSMutableArray *iconUrlArray;


@end

@implementation HeaderBannerCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self!=nil){
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.cycleScrollView];
//        [self.contentView addSubview:self.homeBackgroundView];
//        [self.homeBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.mas_equalTo(self.contentView);
//            make.right.mas_equalTo(self.contentView);
//            make.top.mas_equalTo(self.cycleScrollView.mas_bottom);
//            make.height.mas_offset(kCycleMainCellOffset);
//        }];
        
    }
    return self;
}

- (void)dealloc{
    [self unsubscribeAll];
}

- (void)updateBannerData:(NSArray *)bannerArray{
   
}

#pragma mark - property

//- (UIView *)homeBackgroundView{
//    if (!_homeBackgroundView) {
//        _homeBackgroundView = [[UIView alloc]init];
//        _homeBackgroundView.backgroundColor = [UIColor whiteColor];
//    }
//    return _homeBackgroundView;
//}


#pragma mark - CycleScrollView

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
    
}

- (SDCycleScrollView *)cycleScrollView{
    if (!_cycleScrollView) {
        //CGFloat scrollHeight = [ScreenAdaptationHelper heightAdaptation:437];//   ScreenWidth * 475 /750;
         CGFloat height = SCREEN_WIDTH*189/375;
        _cycleScrollView =  [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, height) delegate:self placeholderImage:nil];
        //CGFloat offset =  245-30;//90为偏移量
        _cycleScrollView.cycleScrollviewPageControlStartYOffset = 31;
        _cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
        _cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleClassic;
        _cycleScrollView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        _cycleScrollView.autoScrollTimeInterval = 4;
        _cycleScrollView.backgroundColor = [UIColor clearColor];
    }
    return _cycleScrollView;
}


+  (CGFloat)heightForCell{
    CGFloat height = SCREEN_WIDTH * 215 / 375;
    return height;
}



@end
